<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr="aabccd"
        var str=arr.split("")

        var res =str.reduce(function(pre,cur){
            if(pre.indexOf(cur)===-1){
                return pre.concat(cur)
            }else{
                return pre
            }
        },[])
        var arr1=res.join("")
        console.log(arr1);
    </script>
</body>
</html>